
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.tss.util.*"%>
<%@page import="com.jedi.*"%>
<%@page import="com.store.*"%>
<%@page import="com.store.TaskMgr"%>
<%@page import="com.store.Task"%>
<%@page import="com.store.TaskDetail"%>
<%@page import="java.util.*"%>
<%@page import="java.text.*"%>

<%@page import="java.sql.*"%>
<%@include file="../global_var.jsp"%>
<%@include file="../check_login.jsp"%>

<%
			int pageno = Integer.parseInt((String) (session
			.getAttribute("pageno")));//页码
	String taskid = ParamUtils.getParameter(request, "taskid", "");
	String triptype_name = ParamUtils.getParameter(request,
			"triptype_name", "");
	String strErr = "";
	TaskMgr taskMgr = new TaskMgr();
	Task task = taskMgr.get(taskid);
	if (task == null || task.getTaskid().trim().equals(""))
		strErr = "此工单信息不存在!";
	User just_user = (User) session.getAttribute("LoginUser");
	String power_enable_id = "10204";//修改(本人)
	String power1_enable_id = "10209";//工单修改(全部)
	String power2_enable_id = "10210";//金额修改
	if (!just_user.hasPower(power1_enable_id)) {
		if (!just_user.hasPower(power_enable_id)) {
			out.println(strNoPowerInfo);
			return;
		} else if (!just_user.getId().trim().equals(
		task.getEngineerid())) {
			out.println(strNoPowerInfo);
			return;
		}
	}
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";

	List list = null;

	String cmd = ParamUtils.getParameter(request, "cmd", "");
	String area_id = ParamUtils.getParameter(request, "area_id", "");
	String cusname = ParamUtils.getParameter(request, "cusname", "");
	String linkman = ParamUtils.getParameter(request, "linkman", "");
	String phone = ParamUtils.getParameter(request, "phone", "");
	String addr = ParamUtils.getParameter(request, "addr", "");

	String conid = ParamUtils.getParameter(request, "conid", "");
	int status = Integer.parseInt(ParamUtils.getParameter(request,
			"status", "0"));
	String begin_date = ParamUtils.getParameter(request, "begin_date",
			TSSDate.shortDate());
	String end_date = ParamUtils.getParameter(request, "end_date",
			TSSDate.shortDate());
	String engineerid = ParamUtils.getParameter(request, "engineerid",
			"");

	String taskscore = ParamUtils.getParameter(request, "taskscore",
			"0");
	String scoreman = ParamUtils.getParameter(request, "scoreman", "");
	String scoretime = ParamUtils.getParameter(request, "scoretime",
			"0");
	String spartfee = ParamUtils.getParameter(request, "spartfee",
			"0.00");
	String outefee = ParamUtils
			.getParameter(request, "outefee", "0.00");
	String matterinfo = ParamUtils.getParameter(request, "matterinfo",
			"");
	String servicelog = ParamUtils.getParameter(request, "servicelog",
			"");
	String diffmod = ParamUtils.getParameter(request, "diffmod", "0");
	String taskaddress = ParamUtils.getParameter(request,
			"taskaddress", TSSDate.shortDate());
	int triptype = Integer.parseInt(ParamUtils.getParameter(request,
			"triptype", "0"));
	String normaltime = ParamUtils.getParameter(request, "normaltime",
			"0");
	String worktime = ParamUtils.getParameter(request, "worktime", "0");
	String tasktime = ParamUtils.getParameter(request, "tasktime", "0");

	String tripfee = ParamUtils
			.getParameter(request, "tripfee", "0.00");
	String tasklile = ParamUtils.getParameter(request, "tasklile", "");

	if (cmd.trim().equals("update")) {

		if (strErr.trim().equals("") && task.getStatus() == 3) {
			if (!just_user.hasPower(power2_enable_id)) {
		strErr = "工单已结束，不能再被修改!";
			}
		}
		if (strErr.trim().equals("") && taskid.trim().equals("")) {
			strErr = "工单编号不能为空!";
		}
		if (strErr.trim().equals("") && cusname.trim().equals("")) {
			strErr = "请输入客户名称!";
		}
		if (strErr.trim().equals("") && conid.trim().equals("")) {
			strErr = "请选择合同!";
		}
		if (strErr.trim().equals("") && area_id.trim().equals("")) {
			strErr = "请选择区域!";
		}

		if (strErr.trim().equals("") && matterinfo.length() >= 600) {
			strErr = "服务内容在600字以内!";
		}
		if (strErr.trim().equals("") && servicelog.length() >= 600) {
			strErr = "工作纪要在600字以内!";
		}

		if (strErr.trim().equals("")) {
			try {
		Float.parseFloat(tripfee);
			} catch (Exception ex) {
		strErr = "差旅费输入错误!";
			}
		}
		if (strErr.trim().equals("")) {
			try {
		Float.parseFloat(spartfee);
			} catch (Exception ex) {
		strErr = "备件成本输入错误!";
			}
		}
		if (strErr.trim().equals("")) {
			try {
		Integer.parseInt(normaltime);
			} catch (Exception ex) {
		strErr = "正常工作量输入错误!";
			}
		}
		if (strErr.trim().equals("")) {
			try {
		Integer.parseInt(tasktime);
			} catch (Exception ex) {
		strErr = "合计工作量输入错误!";
			}
		}
		if (strErr.trim().equals("")) {
			try {
		Integer.parseInt(worktime);
			} catch (Exception ex) {
		strErr = "加班工作量输入错误!";
			}
		}
		if (strErr.trim().equals("")) {
			try {
		Float.parseFloat(outefee);
			} catch (Exception ex) {
		strErr = " 外部人员技术成本输入错误!";
			}
		}
		if (strErr.trim().equals("")) {
			FormatDate formatDate = new FormatDate();
			task.setTaskid(taskid);
			task.setArea_id(area_id);
			task.setCusname(cusname);
			task.setLinkman(linkman);
			task.setPhone(phone);
			task.setAddr(addr);

			task.setStatus(status);
			task.setBegindate(formatDate.toDate(begin_date));
			task.setEnddate(formatDate.toDate(end_date));
			task.setEngineerid(just_user.getId());
			task.setTaskscore(Integer.parseInt(taskscore));
			task.setScoreman(scoreman);
			task.setScoretime(formatDate.toDate(scoretime));
			task.setMatterinfo(matterinfo);
			task.setServicelog(servicelog);
			task.setDiffmod(Integer.parseInt(diffmod));
			task.setTaskaddress(taskaddress);
			task.setTriptype(triptype);
			task.setWorktime(Integer.parseInt(worktime));
			task.setTasktime(Integer.parseInt(tasktime));
			task.setTripfee(Double.parseDouble(tripfee));
			task.setSpartfee(Double.parseDouble(spartfee));
			task.setOutefee(Double.parseDouble(outefee));
			task.setTasklile(tasklile);
			task.setNormaltime(Integer.parseInt(normaltime));
			task.update();
			if (task.hasErr())
		strErr = task.getErrHtml();
		}
	}

	if (cmd.trim().equals("")) {
		area_id = task.getArea_id();
		cusname = task.getCusname();
		linkman = task.getLinkman();
		phone = task.getPhone();
		addr = task.getAddr();
		conid = task.getConid() + "";
		status = task.getStatus();
		begin_date = task.getBegindate() + "";
		end_date = task.getEnddate() + "";
		engineerid = task.getEngineerid();
		spartfee = FormatNum.formatNumber(task.getSpartfee());
		taskscore = task.getTaskscore() + "";
		scoreman = task.getScoreman();
		scoretime = task.getScoretime() + "";
		matterinfo = task.getMatterinfo();
		servicelog = task.getServicelog();
		diffmod = task.getDiffmod() + "";
		taskaddress = task.getTaskaddress();
		triptype = task.getTriptype();
		normaltime = task.getNormaltime() + "";
		worktime = task.getWorktime() + "";
		tasktime = task.getTasktime() + "";
		tripfee = FormatNum.formatNumber(task.getTripfee());
		outefee = FormatNum.formatNumber(task.getOutefee());
		tasklile = task.getTasklile();
	}
	if (cmd.trim().equals("delete")) {
		if (!just_user.getId().trim().equals(task.getEngineerid()))
			strErr = "您没有删除此工单的权限";
		if (task.getStatus() == 3)
			strErr = "工单已经结束不能删除！";
		if (strErr.trim().equals("")) {
			task.setTaskid(taskid);
			task.delete();

			if (task.hasErr())
		strErr = task.getErrHtml();
		}
	}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'task_add.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link href="style/main.css" rel="stylesheet" type="text/css">
		<script language="javascript" src="js/common.js"></script>
		<script language="javascript">
function clk_goback() {
	location.href="task_list.jsp?mgh="+operatorForm.pageno.value;
}
function clk_submit() {
	var oForm = document.operatorForm;
	oForm.cmd.value = "update";
	oForm.submit();
}

function clk_insert_rate(contract_id,intType) {
	var str = "contract_rate_insert.jsp?rate_type=" + intType + "&contract_id=" + contract_id;
	var r = window.showModalDialog('../selectFrm.htm',str,'dialogHeight: 300px;dialogWidth: 400px;center:yes;dialogHide:no;status:no;help: no');
   	if(r != null)
   	{
   		ifrmActiveArea.location.href = "contract_rate_refresh.jsp?rate_type=" + intType + "&contract_id=" + contract_id;
   	}
}

function clk_sel_businfo(){
var str = "salecontract_mgt/contract_sel_bus.jsp";
	var oForm = document.operatorForm;
	var r = window.showModalDialog('../selectFrm.htm',str,'dialogHeight:400px;dialogWidth: 400px;center:yes;dialogHide:no;status:no;help: no');
   	if(r != null)
   	{
   		var valArray = r.split(",");
   			oForm.busid.value = valArray[0];
   			oForm.busname.value = valArray[4];
   		
   	}
}
function clk_insert_task_nadu() {
	var str = "task_nandu_add.jsp";
	var oForm = document.operatorForm;
	var r = window.showModalDialog('selectFrm.htm',str,'dialogHeight: 400px;dialogWidth: 540px;center:yes;dialogHide:no;status:no;help: no');
   	if(r != null)
   	{
   		var valArray = r.split(",");
   		oForm.contract_id.value = valArray[0];
   		if (valArray.length >= 2)
   			oForm.service_id.value = valArray[1];
   	}
}


function clk_insert_detail(task_id) {
	<%if (task.getStatus() == task_status.length - 1){%>
	alert("工单已结束，不能再被修改!");
	return;
	<%}else{%>
	var str = "task_mgt/task_detail_insert.jsp?task_id=" + task_id;
	var r = window.showModalDialog('../selectFrm.htm',str,'dialogHeight: 300px;dialogWidth: 400px;center:yes;dialogHide:no;status:no;help: no');
   	if(r != null)
   	{
   		ifrmActiveArea.location.href = "task_detail_refresh.jsp?task_id=" + task_id;
   	}
   	<%}%>
}

function clk_delete_detail(partid) {
if (!confirm("确定要删除？"))
		return;
	<%if (task.getStatus() == 3){%>
	alert("工单已结束，不能再被修改!");
	return;
	<%}else{%>
	ifrmActiveArea.location.href = "task_detail_refresh.jsp?cmd=delete&list_id=" + partid;
	<%}%>
}
function upload_file() {
	var oForm = document.operatorForm;
	var r = window.showModalDialog('../selectFrm.htm','task_mgt/tasklile_upload.jsp','dialogHeight: 200px;dialogWidth: 300px; center: yes; status:no;help: no');
	if(r && r != "") {
		oForm.tasklile.value = r;
	}
}

function clk_delete_submit() {
	if (!confirm("确定要删除此信息吗？"))
		return;
	var oForm = document.operatorForm;
	oForm.cmd.value = "delete";
	oForm.submit();
}
</script>
	</head>
	<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td>
					<form name="operatorForm" method="get"
						onsubmit="return clk_submit();">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">

							<tr>
								<td height="100" align="center" valign="top"
									style="padding-top:20px;padding-bottom:10px;">

									<table width="88%" border="0" cellpadding="3" cellspacing="1"
										bgcolor="#FFFFFF">
										<tr>
											<td height="24" colspan="7" bgcolor="#EDEDF0"
												style="padding-left:10px;">
												提示：
												<font color="red">*</font> 号为必填项，请您认真填写
											</td>
										</tr>
										<%
										if (!strErr.trim().equals("")) {
										%>
										<tr>
											<td height="24" colspan="3" bgcolor="#D7D7DB"
												style="padding-left:10px;">
												错误提示：

												<font color=red><%=strErr%>
												</font>
											</td>
										</tr>
										<%
										}
										%>
										<%
													if (task.getEngineerid().trim().equals(just_user.getId())
													&& task.getStatus() != 3) {
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">所在区域：</font><font color="red">*</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<select name="area_id" style="width:80px">
													<%
													for (int i = 0; i < area_item_info.length; i++) {
													%>
													<option value="<%=area_item_info[i]%>"
														<%if (area_id.trim().equals(area_item_info[i])){%>
														selected <%}%>>
														<%=area_item_info[i]%>
													</option>
													<%
													}
													%>
												</select>
											</td>
										</tr>
										<tr>
											<td height="22" align="right" bgcolor="#858585">
												<font color="#FFFFFF">工单编号：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">

												<input name="taskid" type="text" value="<%=taskid%>"
													size="30" maxlength="50" readonly="readonly"
													style="background-color:#EDEDE8" class="inputbox">
											</td>

										</tr>

										<tr>
											<td height="22" align="right" bgcolor="#858585">
												<font color="#FFFFFF">客户名称：</font><font color="red">*</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input name="cusname" type="text" value="<%=cusname%>"
													size="30" maxlength="50" class="inputbox">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">工程师姓名：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input name="engineerid" type="text"
													value="<%=task.getEngineername()%>" class="inputbox"
													size="30" style="background-color:#EDEDE8"
													readonly="readonly" size="20" maxlength="50"
													class="inputbox">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">客户联系人：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input name="linkman" type="text" value="<%=linkman%>"
													size="30" maxlength="25" class="inputbox">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">联系电话：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input name="phone" type="text" value="<%=phone%>" size="30"
													maxlength="50" class="inputbox">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">联系地址：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input name="addr" type="text" value="<%=addr%>" size="80"
													maxlength="80" class="inputbox">
											</td>
										</tr>

										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">所属合同号：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input name="conid" type="text" value="<%=conid%>" size="30"
													maxlength="25" class="inputbox" readonly="readonly"
													style="background-color:#EDEDE8">

											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">工单状态：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<%
														String status_str = "";
														if (task.getStatus() == 0) {
															status_str = "登记";
														}
														if (task.getStatus() == 1) {
															status_str = "进行中";
														}
														if (task.getStatus() == 2) {
															status_str = "已完成";
														}
														if (task.getStatus() == 3) {
															status_str = "结束";
														}
												%>
												<input type="text" name="typestr" size="30"
													readonly="readonly" class="inputbox"
													value="<%=status_str%>" style="background-color:#EDEDE8">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">服务预计开始日期：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<span id="htmlBeginTime">&nbsp;</span>
											</td>
										</tr>

										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">服务预计结束日期：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<span id="htmlEndTime">&nbsp;</span>
											</td>
										</tr>
										<%
										if (task.getAbegindate() != null) {
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">服务实际开始日期：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">

												<input type="text" name="abegindate"
													value="<%=task.getAbegindate()%>" class="inputbox"
													size="25" readonly="readonly"
													style="background-color:#EDEDE8">
											</td>
										</tr>
										<%
										}
										%>
										<%
										if (task.getAenddate() != null) {
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">服务实际结束日期：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">

												<input type="text" name="aenddate" size="30"
													value="<%=task.getAenddate()%>" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
											</td>
										</tr>
										<%
										}
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">正常工作量(小时)：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="normaltime" type="text" value="<%=normaltime%>"
													size="30" maxlength="10" class="inputbox" style="background-color:#EDEDE8" readonly="readonly">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">加班工作量(小时)：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="worktime" type="text" value="<%=worktime%>"
													size="30" maxlength="10" class="inputbox">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">合计工作量(天)：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="tasktime" type="text" value="<%=tasktime%>"
													size="30" maxlength="10" class="inputbox" style="background-color:#EDEDE8" readonly="readonly">
											</td>
										</tr>

										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">出差地点：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="taskaddress" value="<%=taskaddress%>"
													type="text" size="80" maxlength="80" class="inputbox">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">出差方式：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<select name="triptype" style="width:80px">


													<option value="1" <%if (triptype==1) {%> selected <%}%>>
														飞机
													</option>

													<option value="2" <%if (triptype==2) {%> selected <%}%>>
														火车
													</option>

													<option value="3" <%if (triptype==3) {%> selected <%}%>>
														汽车
													</option>
													<option value="4" <%if (triptype==4) {%> selected <%}%>>
														其它
													</option>
												</select>
											</td>
										</tr>
										<tr>
											<td height="24" bgcolor="#858585" style="padding-right:5px;"
												align="right">
												<font color="#FFFFFF">工单附件：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input type="text" name="tasklile" value="<%=tasklile%>"
													size="50" class="inputBox" maxlength="100"
													style="background-color:#EDEDE8" readonly="readonly">
												&nbsp;
												<input type="button" value="上传附件" class="inputButton"
													onclick="upload_file();">
											</td>
										</tr>
										<%
										if (just_user.hasPower(power2_enable_id)) {
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">备件成本：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">

												<input name="spartfee" type="text" value="<%=spartfee%>"
													size="30" maxlength="10" class="inputbox">
												￥
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">外部人员技术成本：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="outefee" type="text" value="<%=outefee%>"
													size="30" maxlength="10" class="inputbox">
												￥
											</td>
										</tr>

										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">差旅费：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="tripfee" type="text" value="<%=tripfee%>"
													size="30" maxlength="10" class="inputbox">
												￥
											</td>
										</tr>
										<%
										} else {
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">备件成本：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">



												<input name="spartfee" type="text" value="<%=spartfee%>"
													size="30" maxlength="10" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
												￥


											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">外部人员技术成本：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="outefee" type="text" value="<%=outefee%>"
													size="30" maxlength="10" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
												￥
											</td>
										</tr>

										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">差旅费：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="tripfee" type="text" value="<%=tripfee%>"
													size="30" maxlength="10" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
												￥
											</td>
										</tr>
										<%
										}
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">服务内容：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<textarea name="matterinfo" cols="55" rows="4"
													class="inputarea"><%=matterinfo%></textarea>
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">工作记要：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<textarea name="servicelog" cols="55" rows="4"
													class="inputarea"><%=servicelog%></textarea>
											</td>
										</tr>
										<tr>
											<td height="24" colspan="2" bgcolor="#D7D7DB"
												style="padding-left:10px;">
												明细信息：
											</td>
										</tr>
										<tr>
											<td bgcolor="#EDEDF0" colspan="2"
												style="padding: 3px 3px 3px 3px;" id="tbTaskDetail">
												<table width="100%" border="0" cellpadding="0"
													cellspacing="1" bgcolor="#EDEDF0">
													<tr align="center" bgcolor="#D7D7DB">
														<td width="15%" height="24">
															取出部件PN
														</td>
														<td width="15%">
															取出部件SN
														</td>
														<td width="15%">
															装入部件PN
														</td>
														<td width="15%">
															装入部件SN
														</td>
														<td width="17%">
															文档
														</td>
														<td width="18%">
															描述
														</td>
														<td width="5%">
															<img src="images/insert_tag.gif" title="插入信息"
																style="cursor:hand;"
																onclick="clk_insert_detail('<%=taskid%>');">
														</td>
													</tr>
													<%
															list = task.getListDetail();
															if (list != null && list.size() > 0) {
																for (int i = 0; i < list.size(); i++) {
															TaskDetail detail = (TaskDetail) list.get(i);
													%>
													<tr align="center" bgcolor="#FFFFFF">
														<td height="24">
															<%=detail.getOutPartNo()%>
														</td>
														<td>
															<%=detail.getOutSerialNo()%>
														</td>
														<td>
															<%=detail.getRevPartNo()%>
														</td>
														<td>
															<%=detail.getSerialNo()%>
														</td>
														<td>
															<a
																href="do_download.jsp?filename=upload/taskDetail/<%=detail.getContextFile()%>"><%=detail.getContextFile()%>
															</a>
														</td>
														<td>
															<%=detail.getContextDesc()%>
														</td>
														<td>
															<img src="images/dustbin_tag.gif" title="删除信息"
																style="cursor:hand;"
																onclick="clk_delete_detail('<%=detail.getId()%>');">
														</td>
													</tr>
													<%
															}
															}
													%>
												</table>
											</td>
										</tr>
										<%
													} else if ((!task.getEngineerid().trim().equals(just_user.getId()))
													|| task.getStatus() == 3) {
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">所在区域：</font><font color="red">*</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">

												<input name="area_id" type="text" value="<%=area_id%>"
													size="30" maxlength="50" style="background-color:#EDEDE8"
													class="inputbox">
											</td>
										</tr>
										<tr>
											<td height="22" align="right" bgcolor="#858585">
												<font color="#FFFFFF">工单编号：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">

												<input name="taskid" type="text" value="<%=taskid%>"
													size="30" maxlength="50" readonly="readonly"
													style="background-color:#EDEDE8" class="inputbox">
											</td>
										</tr>
										<tr>
											<td height="22" align="right" bgcolor="#858585">
												<font color="#FFFFFF">客户名称：</font><font color="red">*</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input name="cusname" type="text" value="<%=cusname%>"
													size="30" maxlength="50" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">工程师姓名：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input name="engineerid" type="text"
													value="<%=task.getEngineername()%>" size="30"
													style="background-color:#EDEDE8" readonly="readonly"
													size="20" maxlength="50" class="inputbox">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">客户联系人：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input name="linkman" type="text" value="<%=linkman%>"
													size="30" maxlength="25" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">联系电话：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input name="phone" type="text" value="<%=phone%>" size="30"
													maxlength="50" class="inputbox" readonly="readonly"
													style="background-color:#EDEDE8">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">联系地址：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input name="addr" type="text" value="<%=addr%>" size="80"
													maxlength="80" class="inputbox" readonly="readonly"
													style="background-color:#EDEDE8">
											</td>
										</tr>

										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">所属合同号：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input name="conid" type="text" value="<%=conid%>" size="30"
													maxlength="25" class="inputbox" readonly="readonly"
													style="background-color:#EDEDE8">

											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">工单状态：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<%
														String status_str = "";
														if (task.getStatus() == 0) {
															status_str = "登记";
														}
														if (task.getStatus() == 1) {
															status_str = "进行中";
														}
														if (task.getStatus() == 2) {
															status_str = "已完成";
														}
														if (task.getStatus() == 3) {
															status_str = "结束";
														}
												%>
												<input type="text" name="typestr" size="30"
													readonly="readonly" class="inputbox"
													value="<%=status_str%>" style="background-color:#EDEDE8">
											</td>
										</tr>
											
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">服务预计开始日期：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">


												<input type="text" name="begin_date" size="30"
													value="<%=begin_date%>" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
											</td>
										</tr>

										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">服务预计结束日期：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input type="text" name="end_date" size="30"
													value="<%=end_date%>" class="inputbox" readonly="readonly"
													style="background-color:#EDEDE8">

											</td>
										</tr>
										<%
										if (task.getAbegindate() != null) {
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">服务实际开始日期：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">

												<input type="text" name="abegindate"
													value="<%=task.getAbegindate()%>" size="30"
													class="inputbox" readonly="readonly"
													style="background-color:#EDEDE8">
											</td>
										</tr>
										<%
										}
										%>
										<%
										if (task.getAenddate() != null) {
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">服务实际结束日期：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">

												<input type="text" name="aenddate" size="30"
													value="<%=task.getAenddate()%>" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
											</td>
										</tr>
										<%
										}
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">正常工作量(小时)：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="normaltime" type="text" value="<%=normaltime%>"
													size="30" maxlength="25" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">加班工作量(小时)：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="worktime" type="text" value="<%=worktime%>"
													size="30" maxlength="25" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">合计工作量(天)：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="tasktime" type="text" value="<%=tasktime%>"
													size="30" maxlength="25" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
											</td>
										</tr>

										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">出差地点：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="taskaddress" value="<%=taskaddress%>"
													type="text" size="50" maxlength="80" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">出差方式：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">

												<%
															if (task.getTriptype() == 1) {
															triptype_name = "飞机";
														}
														if (task.getTriptype() == 2) {
															triptype_name = "火车";
														}
														if (task.getTriptype() == 3) {
															triptype_name = "汽车";
														}
														if (task.getTriptype() == 4) {
															triptype_name = "其它";
														}
												%>

												<input name="triptype_name" type="text"
													value="<%=triptype_name%>" size="30" maxlength="15"
													class="inputbox" readonly="readonly"
													style="background-color:#EDEDE8">
												<input name="triptype" type="hidden" value="<%=triptype%>"
													size="30" maxlength="15" class="inputbox">


											</td>
										</tr>
										<%
										if (just_user.hasPower(power2_enable_id)) {
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">备件成本：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">

												<input name="spartfee" type="text" value="<%=spartfee%>"
													size="30" maxlength="10" class="inputbox">
												￥
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">外部人员技术成本：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="outefee" type="text" value="<%=outefee%>"
													size="30" maxlength="10" class="inputbox">
												￥
											</td>
										</tr>

										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">差旅费：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="tripfee" type="text" value="<%=tripfee%>"
													size="30" maxlength="10" class="inputbox">
												￥
											</td>
										</tr>
										<%
										} else {
										%>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">备件成本：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">



												<input name="spartfee" type="text" value="<%=spartfee%>"
													size="30" maxlength="10" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
												￥


											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">外部人员技术成本：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="outefee" type="text" value="<%=outefee%>"
													size="30" maxlength="10" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
												￥
											</td>
										</tr>

										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">差旅费：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<input name="tripfee" type="text" value="<%=tripfee%>"
													size="30" maxlength="10" class="inputbox"
													readonly="readonly" style="background-color:#EDEDE8">
												￥
											</td>
										</tr>
										<%
										}
										%>
										<tr>
											<td height="24" bgcolor="#858585" style="padding-right:5px;"
												align="right">
												<font color="#FFFFFF">工单附件：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-left:5px;">
												<input type="text" name="tasklile" value="<%=tasklile%>"
													size="50" class="inputBox" maxlength="100"
													style="background-color:#EDEDE8" readonly="readonly">
										
												
											</td>
											</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">服务内容：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<textarea name="matterinfo" cols="55" rows="4"
													class="inputarea" style="background-color:#EDEDE8"
													readonly="readonly"><%=matterinfo%></textarea>
											</td>
										</tr>
										<tr>
											<td height="24" align="right" bgcolor="#858585">
												<font color="#FFFFFF">工作记要：</font>
											</td>
											<td bgcolor="#EDEDF0" style="padding-right:5px;">
												<textarea name="servicelog" cols="55"
													style="background-color:#EDEDE8" rows="4"
													readonly="readonly" class="inputarea"><%=servicelog%></textarea>
											</td>
										</tr>

										<tr>
											<td height="24" colspan="2" bgcolor="#D7D7DB"
												style="padding-left:10px;">
												明细信息：
											</td>
										</tr>
										<tr>
											<td bgcolor="#EDEDF0" colspan="2"
												style="padding: 3px 3px 3px 3px;" id="tbTaskDetail">
												<table width="100%" border="0" cellpadding="0"
													cellspacing="1" bgcolor="#EDEDF0">
													<tr align="center" bgcolor="#D7D7DB">
														<td width="15%" height="24">
															取出部件PN
														</td>
														<td width="15%">
															取出部件SN
														</td>
														<td width="15%">
															装入部件PN
														</td>
														<td width="15%">
															装入部件SN
														</td>
														<td width="17%">
															文档
														</td>
														<td width="18%">
															描述
														</td>

													</tr>
													<%
															list = task.getListDetail();

															if (list != null && list.size() > 0) {
																for (int i = 0; i < list.size(); i++) {
															TaskDetail detail = (TaskDetail) list.get(i);
													%>
													<tr align="center" bgcolor="#FFFFFF">
														<td height="24">
															<%=detail.getOutPartNo()%>
														</td>
														<td>
															<%=detail.getOutSerialNo()%>
														</td>
														<td>
															<%=detail.getRevPartNo()%>
														</td>
														<td>
															<%=detail.getSerialNo()%>
														</td>
														<td>
															<a
																href="do_download.jsp?filename=upload/taskDetail/<%=detail.getContextFile()%>"><%=detail.getContextFile()%>
															</a>
														</td>
														<td>
															<%=detail.getContextDesc()%>
														</td>

													</tr>
													<%
															}
															}
													%>
													<%
													}
													%>
													<tr>
														<td bgcolor="#EDEDF0" colspan="7" align="center">
															<input type="button" onclick="clk_submit()" name="btn2"
																value="保 存" class="inputButton">
															<input type="button"
																onclick="return clk_delete_submit();" name="btn"
																value="删 除" class="inputButton">
															<input type="button" name="button1" value="返 回"
																class="inputButton" onclick="clk_goback();">
															<input type="hidden" name="cmd" value="">
															<input type="hidden" name="pageno" value="<%=pageno%>">

														</td>
													</tr>

												</table>
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</form>
					<script language="javascript">
  <%if(just_user.getId().trim().equals(task.getEngineerid())){%>
	htmlBeginTime.innerHTML = showCalenderInput("begin_date","operatorForm","<%=begin_date%>",1);
	htmlEndTime.innerHTML = showCalenderInput("end_date","operatorForm","<%=end_date%>",1);
	
	<%}%>
</script>
					<iframe id="ifrmActiveArea" name="ifrmActiveArea" frameborder="0"
						width="1" height="1" scrolling="no"></iframe>
					<%
					if (cmd.equals("update") && strErr.trim().equals("")) {
					%>
					<script language="javascript">
alert("记录信息修改成功系统将返回!");
location.href="task_list.jsp?mgh="+operatorForm.pageno.value;
</script>
					<%
					}
					%>

					<%
					if (cmd.equals("delete") && strErr.trim().equals("")) {
					%>
					<script language="javascript">
alert("记录信息删除成功!");
location.href="task_list.jsp?mgh="+operatorForm.pageno.value;
</script>
					<%
					}
					%>
				
	</body>
</html>
